package com.aiwei.tdjk.config;

import com.aiwei.tdjk.common.web.bind.method.annotation.SearchableMethodArgumentResolver;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import java.util.List;

/**
 * 实现添加自定义资源文件夹访问路径
 * Created by yangyanjun on 2017/8/7.
 */
@Configuration
public class MyWebAppConfigurer extends WebMvcConfigurerAdapter {
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/myres/**").addResourceLocations("classpath:/myres/");
        super.addResourceHandlers(registry);

    }

    @Override
    public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
        super.addArgumentResolvers(argumentResolvers);
        argumentResolvers.add(new SearchableMethodArgumentResolver());
    }

//    @Override
//    public void addFormatters(FormatterRegistry registry) {
//        registry.addFormatterForFieldAnnotation(new FormattingConversionServiceFactoryBean());
//        registry.addFormatter();
//        super.addFormatters(registry);
//
    }
